﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="PhongBan.aspx.cs" Inherits="EC2011_hk1_BT3_1041074_1041078_1042119.PhongBan" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="right">
		<div class="content">
            <h3>Danh Danh Sách Phòng Ban</h3>
            <div class="clear"></div>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:PagingDataConnectionString %>" 
                SelectCommand="SELECT * FROM [Departments]"
                UpdateCommand="UPDATE [Departments] SET [Name] = @Name, [URLPhoto] = @URLPhoto, [URLHomePage] = @URLHomePage, [ShowControl] = @ShowControl WHERE [DepartmentID] = @DepartmentID"
                DeleteCommand="DELETE FROM [Departments] WHERE [DepartmentID] = @DepartmentID"
                InsertCommand="INSERT INTO [Departments] VALUES(@Name, @URLPhoto, @URLHomePage, @ShowControl)">

            </asp:SqlDataSource>

            <asp:GridView ID="GridView1" runat="server" CellPadding="4" 
                DataSourceID="SqlDataSource1" BackColor="White" BorderColor="#3366CC" 
                BorderStyle="None" BorderWidth="1px"
                DataKeyNames="DepartmentID">
                <Columns>
                    <asp:TemplateField ShowHeader="False">
                        <EditItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                                CommandName="Update" Text="Update"></asp:LinkButton>
                            &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                CommandName="Cancel" Text="Cancel"></asp:LinkButton>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                                CommandName="Edit" Text="Edit"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField ShowHeader="False">
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                CommandName="Delete" Text="Delete"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
                <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
                <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
                <RowStyle BackColor="White" ForeColor="#003399" />
                <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                <SortedAscendingCellStyle BackColor="#EDF6F6" />
                <SortedAscendingHeaderStyle BackColor="#0D4AC4" />
                <SortedDescendingCellStyle BackColor="#D6DFDF" />
                <SortedDescendingHeaderStyle BackColor="#002876" />
            </asp:GridView>
           
            <h3>Thêm Thêm M&#7899;i Phòng Ban</h3>
            <asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1" 
                DefaultMode="Insert" DataKeyNames="DepartmentID" CellPadding="4" 
                ForeColor="#333333">
                <ItemTemplate>
                    DepartmentID:
                    <asp:Label ID="DepartmentIDLabel" runat="server" 
                        Text='<%# Eval("DepartmentID") %>' />
                    <br />
                    Name:
                    <asp:Label ID="NameLabel" runat="server" Text='<%# Bind("Name") %>' />
                    <br />
                    URLPhoto:
                    <asp:Label ID="URLPhotoLabel" runat="server" Text='<%# Bind("URLPhoto") %>' />
                    <br />
                    URLHomePage:
                    <asp:Label ID="URLHomePageLabel" runat="server" 
                        Text='<%# Bind("URLHomePage") %>' />
                    <br />
                    ShowControl:
                    <asp:Label ID="ShowControlLabel" runat="server" 
                        Text='<%# Bind("ShowControl") %>' />
                    <br />
                </ItemTemplate>
                <EditItemTemplate>
                    DepartmentID:
                    <asp:Label ID="DepartmentIDLabel1" runat="server" 
                        Text='<%# Eval("DepartmentID") %>' />
                    <br />
                    Name:
                    <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
                    <br />
                    URLPhoto:
                    <asp:TextBox ID="URLPhotoTextBox" runat="server" 
                        Text='<%# Bind("URLPhoto") %>' />
                    <br />
                    URLHomePage:
                    <asp:TextBox ID="URLHomePageTextBox" runat="server" 
                        Text='<%# Bind("URLHomePage") %>' />
                    <br />
                    ShowControl:
                    <asp:TextBox ID="ShowControlTextBox" runat="server" 
                        Text='<%# Bind("ShowControl") %>' />
                    <br />
                    <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                        CommandName="Update" Text="Update" />
                    &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                        CausesValidation="False" CommandName="Cancel" Text="Cancel" />
                </EditItemTemplate>
                <EditRowStyle BackColor="#2461BF" />
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <InsertItemTemplate>
                    Name:
                    <asp:TextBox ID="NameTextBox" Text='<%# Bind("Name") %>' runat="server"></asp:TextBox>
                    <br />
                    URLPhoto:
                    <asp:TextBox ID="URLPhotoTextBox" Text='<%# Bind("URLPhoto") %>' runat="server"></asp:TextBox>
                    <br />
                    URLHomePage:
                    <asp:TextBox ID="URLHomePageTextBox" Text='<%# Bind("URLHomePage") %>' 
                        runat="server"></asp:TextBox>
                    <br />
                    ShowControl:
                    <asp:TextBox ID="ShowControlTextBox" runat="server" 
                        Text='<%# Bind("ShowControl") %>' />
                    <br />
                    <asp:LinkButton Text="Insert" CommandName="Insert" runat="server" 
                        ID="InsertButton" CausesValidation="True"/>
                    &nbsp;<asp:LinkButton Text="Cancel" CommandName="Cancel" runat="server" 
                        ID="InsertCancelButton" CausesValidation="False"/>
                </InsertItemTemplate>
                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#EFF3FB" />
            </asp:FormView>
        </div>              
    </div>
</asp:Content>
